const fs = require('fs');
const path = require('path');


//fs.writeFile()            JSON.stringify({id:10}) 实现json序列化
fs.writeFile(path.join(__dirname,'test333'),JSON.stringify({id:10}),(error)=>{

    if(error){
        console.log('error');
    }else{
        console.log('success');
    }
})

//fs.writeFileSync()


//fs.createWriteStream()



//fs.appendFile()
fs.appendFile(path.join(__dirname,'test333'),JSON.stringify({id:10}),(error)=>{

    if(error){
        console.log('error');
    }else{
        console.log('success');
    }
})